layui.use(['table'], function () {
    var table = layui.table;
    var $ = layui.jquery;

    var GroupOrderChangeanble = {
        tableId: "groupOrderChangeanbleTable"    //表格id
    };

    GroupOrderChangeanble.initColumn = function () {
        return [[
            {type: 'numbers', align: "center", title: '序号'},
            {field: 'offeringId', align: "center", title: '资费ID'},
            {field: 'offeringName', align: "center",  title: '资费名称'},
            {field: 'offeringTypeName', align: "center",  title: '资费分类'},
            {field: 'paymentModeName', align: "center", title: '付费模式'},
            {field: 'effectiveDate', align: "center", title: '资费生效时间'},
            {field: 'expiriedDate', align: "center", title: '资费失效时间'},
            {field: 'description', align: "center", title: '资费描述'}
        ]];
    };

    table.render({
        elem: '#' + GroupOrderChangeanble.tableId,
        defaultToolbar: [],
        url: Feng.ctxPath + '/ecGroup/changeableOfferings?groupId=' + $("#ecGroupId").val() + '&accountId=' + $("#ecAccountId").val() + '&offeringId=' + $("#ecOfferingId").val(),
        height: "full-98",
        cellMinWidth: 100,
        page: {
            prev: "上一页",
            next: "下一页",
            layout: ['prev', 'next'],
            limit: 10
        },
        cols: GroupOrderChangeanble.initColumn(),
        done:function(res, curr, count){
            // 鼠标显示过长的表头
            tdTitle();
        }
    });


    function tdTitle() {
        $('th').each(function(index,element){
            $(element).attr('title',$(element).text());
        });
        $('td').each(function(index,element){
            $(element).attr('title',$(element).text());
        });
    }

});